Python's favorite unexplained incantation: def main if __name__ == '__main__'. In this video I explain why your Python scripts should use this idiom. It's not strictly necessary, but you will be a better Python coder if you follow established conventions that improve the readability of your code. ― mCoding with James Murphy (https://mcoding.io) Source code: https://github.com/mCodingLLC/VideosSampleCode StackOverflow on the topic: https://stackoverflow.com/questions/419163/what-does-if-name-main-do Python docs: https://docs.python.org/3/reference/toplevel_components.html#complete-python-programs SUPPORT ME ⭐ --------------------------------------------------- Sign up on Patreon to get your donor role and early access to videos! https://patreon.com/mCoding Feeling generous but don't have a Patreon? Donate via PayPal! (No sign up needed.) https://www.paypal.com/donate/?hosted_button_id=VJY5SLZ8BJHEE Want to donate crypto? Check out the rest of my supported donations on my website! https://mcoding.io/donate Top patrons and donors: Jameson, John M, Laura M, Pieter G, Vahnekie, Sigmanificient BE ACTIVE IN MY COMMUNITY 😄 --------------------------------------------------- Discord: https://discord.gg/Ye9yJtZQuN Github: https://github.com/mCodingLLC/ Reddit: https://www.reddit.com/r/mCoding/ Facebook: https://www.facebook.com/james.mcoding CHAPTERS --------------------------------------------------- 0:00 Intro 0:58 Dunder name 1:47 Why if name main 3:36 Why def main 4:59 Pickle example 5:42 Multiprocessing example 6:42 Main function entry point 7:07 Outro